package main

import "fmt"

func main() {
	list := []int{1,2,10,4,7,6}
	selects(list)
	fmt.Println(list)
}

//选择排序

func selects(list []int)  {
	if len(list) == 0{
		return
	}
	temp := 0
	index := 0
	for n:=0;n<len(list);n++{
		for i:=0;i<len(list)-n;i++{
			if list[i]>=temp {
				temp = list[i]
				index = i
			}
			if i == len(list)-n-1{
				list[len(list)-1-n],list[index] = list[index],list[len(list)-1-n]
				temp = 0
				index = 0
			}
		}
	}

}